From: Florijan Hamzic Date: Thu, 3 Dec 2020 22:36:33 +0000 (+0100) Subject: lookingGlass: Sort extensions alphabetically X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~698 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=659df23ad35277106dfaf8194a7327349a2535ee;p=gnome-shell.git lookingGlass: Sort extensions alphabetically Extensions are currently listed in random order, which is hardly user-friendly. Instead, sort them alphabetically to make the list easier to parse. Part-of: --- diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 147e46b2e..109c04631 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -687,7 +687,10 @@ var Extensions = GObject.registerClass({ this._extensionsList.remove_actor(this._noExtensions); this._numExtensions++; - this._extensionsList.add(extensionDisplay); + const { name } = extension.metadata; + const pos = [...this._extensionsList].findIndex( + dsp => dsp._extension.metadata.name.localeCompare(name) > 0); + this._extensionsList.insert_child_at_index(extensionDisplay, pos); } _onViewSource(actor) { @@ -750,6 +753,7 @@ var Extensions = GObject.registerClass({ _createExtensionDisplay(extension) { let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true }); + box._extension = extension; let name = new St.Label({ style_class: 'lg-extension-name', text: extension.metadata.name,